package rasterprimate;

import repast.simphony.engine.environment.RunEnvironment;
import repast.simphony.parameter.Parameters;

public class Constants {

	final static Parameters p = RunEnvironment.getInstance().getParameters();
	
	//build environment
	public static boolean map = (Boolean) p.getValue("fromMapFile");
	public static Double regrowth = (Double)p.getValue("regrowRate");
	public static final int cellSize = 30;
	public static final double resLevel = 100*70/50; //if uniformly distributed this would be the value of each cell
	public static final double foodMag = 1;
	public static final double backgroundFood = 0.25;
	
	//build primate groups
	public static int groupSize = (Integer)p.getValue("groupSize");
	public static int numberOfGroups = (Integer)p.getValue("numbGroup");
	
	//group dynamics
	public static double primateSearchRange = (Double)p.getValue("searchGroupMates");
	public static int safeDelta = (Integer)p.getValue("safeDelta");
	public static double safeRadius = (Double)p.getValue("safeRadius");
	public static final int maxSafety = 69;
	public static final int minSafety = 0;
	public static boolean leaderBased=(Boolean) p.getValue("Despotic"); //democratic of despotic (leader based)?
	
	//foraging and energy balance
	public static double foodSearchRange = (Double)p.getValue("searchRadius");
	public static double feedingTime = (Double)p.getValue("feedingTime");
	public static double maxDistPerStep = (Double)p.getValue("maxDist");
	public static final boolean considerDistance = true; //when comparing visual sites
	
	//memory
	public static boolean topoMem = (Boolean)p.getValue("topoMem");
	public static double nearSites = (Double)p.getValue("nearFoodSites");
	public static int memRetention = (Integer)p.getValue("memRetention");
	public static final double weightOfMem = 1; //no extra weight applied in this model (i.e. 1*x=x)
	
	//System level parameters
	public static final String GRID_ID = "grid";
	public static final String SPACE_ID = "space";
	public static final String GEOG_ID = "geog";
	public static final String FoodValueLayer = "food";
	public static final int stepsPerDay = 26;
	public static int stopTime = (Integer)p.getValue("days");
	
	//measuring group center
	public static final double groupArea = 100;
	public static final double groupThreshold = 0.80;
	
	public Constants(){  //this sets the parameters
		
		//environment
		map = (Boolean) p.getValue("fromMapFile");
		Double regrowth = (Double)p.getValue("regrowRate");
		
		//build primate groups
		groupSize = (Integer)p.getValue("groupSize");
		numberOfGroups = (Integer)p.getValue("numbGroup");
		
		//group dynamics
		leaderBased=(Boolean) p.getValue("Despotic");
		primateSearchRange = (Double)p.getValue("searchGroupMates");
		safeDelta = (Integer)p.getValue("safeDelta");
		safeRadius = (Double)p.getValue("safeRadius");
		
		//foraging and energy balance
		foodSearchRange = (Double)p.getValue("searchRadius");
		feedingTime = (Double)p.getValue("feedingTime");
		maxDistPerStep = (Double)p.getValue("maxDist");
		
		//memory
		topoMem = (Boolean)p.getValue("topoMem");
		nearSites = (Double)p.getValue("nearFoodSites");
		memRetention = (Integer)p.getValue("memRetention");
		
		//system level parameters
		stopTime = (Integer)p.getValue("days");
	}
	
}
